import AdButton from '../packages/button/index'
import Has from '../packages/has/index'
import PreventReClick from '../packages/prevent-re-click/index'
import Rotate from '../packages/rotate/index'

const components = [
    AdButton
]

const install = (Vue, opts = {}) => {

    // install directive
    Vue.use(Has);
    Vue.use(PreventReClick);
    Vue.use(Rotate);

    // install component
    components.forEach(component => {
        Vue.component(component.name, component);
    });

    // install attribute
    Vue.prototype.$ADEN = {
        size: opts.size || '',
        zIndex: opts.zIndex || 2000
    };

}

/* istanbul ignore if */
if (typeof window !== 'undefined' && window.Vue) {
    install(window.Vue);
}

export default {
    install,
    AdButton,
    Has,
    PreventReClick,
    Rotate,
}
